package com.kuiandjie.web;


import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;


import com.kuiandjie.entity.FileType;

import com.kuiandjie.entity.Project;

import com.kuiandjie.service.FileTypeService;

public class FileServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		HttpSession session = request.getSession();
		Project pro = (Project) session.getAttribute("curp");
		if(pro == null){
			response.sendRedirect("main.jspx");
		}
		
		int proid = pro.getId();
		
		FileTypeService fts = new FileTypeService();
		List<FileType> ftlist = fts.findByEmpIdAndProId(proid);
		
		request.setAttribute("ftlist", ftlist);
		
		
		request.getRequestDispatcher("WEB-INF/views/file.jsp").forward(request, response);
	}

}
